<?php 
    $theme_id =  -1;
    $theme_id = Configure::read('App.themes.site_current');
    if(!empty($theme_id)){
      $theme_id = $theme_id['sub_sites']['themes']['id'];                
    } 
    $is_Administrator = Configure::read('Is_Administrator');    
?>
<?php echo $this->Form->create('Paginate', array('id' => 'paginate', 'url' => $this->request->here(false), 'type' => 'post', 'inputDefaults' => array('label' => false))); ?>           				
<div id="content-header">
	<h1><?php echo __d('system','Content Management');?></h1>
    <?php     echo $this->element('toolbar');?>	      
    
</div>
<div class="container-fluid">
<div class="row-fluid">
    <div class="span12">
        <?php $defaultLanguage = Router::defaultLanguage();
            $_queries = array('continue' => $this->request->here(false));
        ?> 
                 
         							
        <div class="widget-box widget-content-no-padding">
            <!--For manage node normal-->
                <div class="widget-content widget-content-two">
                
                <?php echo $this->Session->flash(); ?>
                <table class="table table-bordered data-table table-striped wd-hover-btn">
                    <thead>
						<tr>
							<th style="text-align:left"><?php echo  __d('system', 'Title'); ?></th>
							<th width="12%"><?php echo  __d('system', 'Priority'); ?></th>
							<th style="text-align:left" width="18%"><?php echo  __d('system', 'Catalog'); ?></th>
							<th width="8%">Translate</th>
							<th width="12%"><?php echo  __d('system', 'Action'); ?></th>
						</tr>
					</thead>
                    <tbody id="tbody-index">
                        
                        <?php foreach ($listNodes as $node) : ?>                                            
                            <tr>            
                                <?php if (isset($_displayFields['title'])): ?>       
                                    <td>
                                        <a href="<?php echo $this->Html->url(array('plugin'=>'node','controller' => 'node', 'action' => 'edit', $node['Node']['node_type_id'], $node['Node']['id'], '?' => $_queries));?>"> 
                                            <span class="wd-asideleft"><?php echo $node['Node']['title']; ?></span></a>
                                    </td>
                                <?php endif; ?>
                                <td><span class="priority"><?php echo $node['Node']['field_priority']; ?></span></td>
                                <?php if (isset($_displayFields['node_type_id'])): ?>       
                                    <td>
                                        <a href="#">  <?php echo $node['NodeType']['name']; ?></a>
                                    </td>
                                    <?php endif; ?>    
                                <td>
                                    <?php if (isset($_translateMaps)): ?>
                                        <ul class="wd-laguage">
                                            <?php
                                                foreach (Configure::read('Languages') as $_language) {
                                                    if ($_language['code'] === $defaultLanguage) {
                                                        continue;
                                                    } 
                                                    if(empty($_language['path'])){
                                                        $flags = 'flags_default.png';                                                
                                                    }
                                                    else{$flags = $_language['path'];}                                                                                        
                                                ?>
                                                
                                                <li><?php  echo $this->Html->link($this->Html->image('/img/' .$flags), array('plugin'=>'node','controller'=>'node','action' => 'translate', $node['Node']['id'], $_language['code'], '?' => $_queries), array(
                                                            'class' => 'tip-top', 'escape' => false, 'title' => $_language['name']));?></li>           
                                                <?php }?>
                                        </ul>
                                        <?php endif; ?>  
                                </td>
                                
                                <td>
                                    <ul class="wd-link-control">
                                        <li><a href="<?php echo $this->Html->url(array('plugin'=>'node','controller' => 'node', 'action' => 'edit', $node['Node']['node_type_id'], $node['Node']['id'], '?' => $_queries));?>" class="btn btn-mini">
                                                <i class="icon-edit"></i> <?php echo __d('system','Edit');?></a></li>
                                        <li><a href="#<?php echo $node['Node']['id']?>" data-toggle="modal" class="btn btn-mini"><i class="icon-remove"></i> <?php echo __d('system','Delete');?></a></li>                            
                                    </ul>
                                </td>
                            </tr>

                            <?php endforeach?>                        
                    </tbody>
                    
                </table>
                
                <?php foreach ($listNodes as $node) : ?> 
                    <div id="<?php echo $node['Node']['id']?>" class="modal hide">
                        <div class="modal-header">
                            <button data-dismiss="modal" class="close" type="button">×</button>
                            <h3><?php echo __d('system','Alert modal');?></h3>
                        </div>
                        <div class="modal-body">
                            <p><?php echo __d('system','Are you sure delete');?> “<?php echo $node['Node']['title']?>”?</p>
                        </div>
                        <div class="modal-footer">
                            <a data-dismiss="modal" class="btn" href="#"><?php echo __d('system','Cancel');?></a>
                            <?php echo $this->Html->link(__d('system','Delete'), array('plugin'=>'node','controller' => 'node','action' => 'delete_list_index', '?' => array_merge($_queries, array('keys' => array($node['Node']['id']),'_here'=>$this->request->here))), array('title' => false, 'class' => 'btn btn-danger','data-dismiss='=>'modal')); ?>                        
                        </div>
                    </div>  
                <?php endforeach?>								
            </div>
            <!--End-->
            
        </div>
    </div>	    
</div>
<?php         
    echo $this->Form->hidden('task', array('id' => 'task', 'value' => ''));
    echo $this->Form->end();
?>
<style type="text/css">
    .lbl-moved{text-decoration: underline;text-indent: initial;font-size: 16px;font-weight: bold;}
</style>